package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.ArithmeticPlusMinusExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.BitOperatorContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.BitExpressionContext;

/**
 * 位运算表达式语法遍历
 * 
 * @author zwd
 *
 */
public class BitExpressionVisitor extends AbsCQLParserBaseVisitor<BitExpressionContext> {

	private BitExpressionContext context = null;

	public BitExpressionVisitor() {
		context = new BitExpressionContext();
	}

	@Override
	protected BitExpressionContext defaultResult() {
		return context;
	}

	@Override
	public BitExpressionContext visitArithmeticPlusMinusExpression(@NotNull ArithmeticPlusMinusExpressionContext ctx) {
		ArithmeticPlusMinusExpressionVisitor visitor = new ArithmeticPlusMinusExpressionVisitor();
		context.getArithmeticExpressions().add(visitor.visit(ctx));
		return context;
	}

	@Override
	public BitExpressionContext visitBitOperator(@NotNull BitOperatorContext ctx) {
		context.getBitOperator().add(ctx.getText());
		return context;
	}

}
